1. Field of the Invention
The present invention relates generally to databases and, more specifically, to stored procedures in a database.
2. Description of the Background Art
Modern database systems commonly allow users to write procedures that are stored on the database themselves. These procedures are usually a set of one or more statements grouped together as a procedure, which allows the procedure to be called whenever this set of statements needs to be run.
Database systems also commonly perform optimizations to these procedures, as well as the statements that comprise them, in order to enable them to run more efficiently during execution time. One such optimization is the creation of access plans, which instruct the system on how to retrieve the data needed to process a statement. For example, if a statement only needs part of a table from a database in order to perform some computation, an access plan is created which retrieves only the needed part of the table.
However, sometimes these statements include variables or other information which is only known at run-time. Accordingly, when these optimizations are performed, an optimizer has to make certain guesses at what the data will be. This can result in inadequate performance.
Accordingly, what is desired is a method to improve the optimization of stored procedures.